#ifndef KDBUILDQUEUE_H_
#define KDBUILDQUEUE_H_

#include "constants.h"

class AABB;
class KdNode;
class Triangle;

struct QueueEntry
{
//	QueueEntry(KdNode* n, Triangle** tl, const int nt, const AABB& a);
	
	KdNode* node;
	Triangle** triangleList;
	int numTriangles;
	AABB* aabb;
	int depth;
};

class KdBuildQueue
{
public:
	KdBuildQueue();
	virtual ~KdBuildQueue();
	
	void add(KdNode* n, Triangle** tl, const int nt, AABB* a, const int d);
	QueueEntry& remove(void);
	inline bool isEmpty(void) const { return !counter; }
	inline void clear(void) { head = tail = 0; }
	
	void print(void) const; // debug only!
protected:
	QueueEntry queue[KDBUILDQUEUESIZE];
	int head;
	int tail;
	int counter;
private:
	KdBuildQueue(const KdBuildQueue& copy) {}
};

#endif /*KDBUILDQUEUE_H_*/
